package com.click.app.webapp.reportObjects;

import java.util.ArrayList;
import java.util.List;



/**
 * @author Joel Chuca Condo
 * @date 06/07/2009
 */
public class BodyRow {
    private List<String> row; //= new ArrayList<String>();

    public BodyRow(){
        row = new ArrayList<String>();
    }
    public BodyRow(int tam){
        row = new ArrayList<String>(tam);
        for (int i=0 ; i<tam ; i++) {
            row.add("0");
        }
    }

    public List<String> getRow() {
        return row;
    }

    public void setRow(List<String> bodyRow) {
        this.row = bodyRow;
    }

    public void add(String item){
        row.add(item);
    }

    public int size(){
        return row.size();
    }

    @Override
    public String toString() {
        return row.toString();
    }
    public void add(int index, String item){
        String value = "";
        try{

            value = row.get(index);
            Integer x = 0;
            if(value != null)
                x = Integer.parseInt(value);
            Integer y = Integer.parseInt(item);
            row.set(index, (x + y)+"");
        }catch(Exception e){
            row.set(index,"");
            System.out.println("Exceptions :  "+index+" - "+value+" - "+item);
        }
    }

}
